package cacco.jp.mld.panel.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import cacco.jp.mld.panel.dao.ChildDao;
import cacco.jp.mld.panel.entity.ChildEntity;

@Service
public class ChildService {

	@Autowired
	ChildDao childDao;

	public List<ChildEntity> getAll() {
		return childDao.getAll();
	}

	public int addChild(ChildEntity child) {
		return childDao.add(child);
	}

	public void updateChild(ChildEntity child) {
		childDao.update(child);
	}

	public void deleteChild(Integer id) {
		childDao.delete(id);
	}

	public List<ChildEntity> getAlByPage(int pageSize, int page, String sidx,
			String sord) {
		return childDao.getAlByPage(pageSize, page, sidx, sord);
	}

	public boolean isExistChild(int id) {
		ChildEntity entity = null;
		entity = childDao.findById(id);
		if (entity != null) {
			return true;
		}
		return false;
	}

	public int getTotalRecords() {
		return childDao.getTotalRecords();
	}

}
